package com.sanyang.pda.presenter;


import com.sanyang.pda.bean.HaveTestedBean;
import com.sanyang.pda.bean.PalletStatisticsBean;
import com.sanyang.pda.bean.ToBeStoredBean;
import com.sanyang.pda.contract.HaveTestedContract;
import com.sanyang.pda.net.NetUtils;
import com.wangshen.base.net.bean.BaseAppEntity;
import com.wangshen.base.net.bean.BaseRowsAppEntity;
import com.wangshen.base.ui.mvp.base.presenter.BasePresenter;

import java.util.List;

import io.reactivex.functions.Consumer;

public class HaveTestedPresenter extends BasePresenter<HaveTestedContract.View> implements HaveTestedContract.Presenter {

    @Override
    public void samplingResultList(String en) {
        NetUtils.geApi().samplingResultList(en)
                .compose(this.handleEverythingResult())
                .subscribe(new Consumer<BaseAppEntity<List<HaveTestedBean>>>() {
                    @Override
                    public void accept(BaseAppEntity<List<HaveTestedBean>> listBaseRowsAppEntity) throws Exception {
                        getView().setList(listBaseRowsAppEntity.getData());
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        getView().showMessage(throwable.getMessage());
                    }
                });
    }
}
